﻿// =================================================================== 
// 项目说明
//====================================================================
// lsc。@Copy Right 2019
// 文件： DCVehicleViolationQuery.cs
// 项目名称：斑马车务
// 创建时间：2019/8/16
// 负责人：lsc
// ===================================================================
using System;
using System.Data;
using System.Collections.Generic;
using Dapper.Extensions;
using YouWei.Infrastructure.Entity;
using YouWei.Infrastructure.Repository;
namespace YouWei.Infrastructure.Service
{
	
	/// <summary>
	///车辆违章查询
	/// </summary>
	public class DCVehicleViolationQueryService
	{
         protected DCVehicleViolationQueryRepository repository;
         
         public  DCVehicleViolationQueryService(){
           repository = new DCVehicleViolationQueryRepository();         
         }

        #region 增删改查

        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public object Insert(DCVehicleViolationQuery entity) { return repository.Insert(entity); }

        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public object Insert(List<DCVehicleViolationQuery> entitys) { return repository.Insert(entitys); }

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public bool Update(DCVehicleViolationQuery entity) { return repository.Update(entity); }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public bool Delete(DCVehicleViolationQuery entity) { return repository.Delete(entity); }

        /// <summary>
        /// 删除所有
        /// </summary>
        /// <returns></returns>
        public bool DeleteAll() { return repository.DeleteAll(); }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public bool Delete(int primaryKey) { return repository.Delete(primaryKey); }

        /// <summary>
        /// 查询单个实体
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public DCVehicleViolationQuery SingleOrDefault(object primaryKey) { return repository.SingleOrDefault(primaryKey); }

       
        /// <summary>
        /// 查询单个实体,如果存在多条则引发异常
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public DCVehicleViolationQuery Single(object primaryKey) { return repository.Single(primaryKey); }

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        public List<DCVehicleViolationQuery> QueryAll()
        {
            return repository.QueryAll();
        }

        #endregion

        /// <summary>
        /// 未查询数据
        /// </summary>
        /// <returns></returns>
        public DCVehicleViolationQuery GetFirstNoRun()
        {
            return repository.GetFirstNoRun();
        }

        /// <summary>
        /// 获取最近一段时间内最新一条查询记录
        /// </summary>
        /// <param name="hpzl"></param>
        /// <param name="hphm"></param>
        /// <param name="enginecode"></param>
        /// <param name="lastTime"></param>
        /// <returns></returns>
        public DCVehicleViolationQuery GetLastTimeQuery(string hpzl, string hphm, string enginecode, DateTime lastTime)
        {
            return repository.GetLastTimeQuery(hpzl, hphm, enginecode, lastTime);
        }

        /// <summary>
        /// 根据手机号查询所有查询记录  分页
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="hphm"></param>
        /// <returns></returns>
        public Page<DCVehicleViolationQuery> GetPageByMobile(string mobile, int pageIndex, int pageSize, string hphm)
        {
            return repository.GetPageByMobile(mobile, pageIndex, pageSize, hphm);
        }
    }
	
}